<template>
	<view>
		<!-- 全屏 Loading -->
		<graceFullLoading text='暂无可选银行' logoUrl ='../../static/login2.png' :graceFullLoading="graceFullLoading"></graceFullLoading>
		<phone-directory :fakahang="fakahang" :phones="phones" @paramClick="paramClick"></phone-directory>
	</view>
</template>

<script>
	import graceFullLoading from "../../graceUI/components/graceFullLoading.vue";
	import phoneDirectory from '@/components/phone-directory/phone-directory.vue'
	export default {
		name:"phones",
		components:{
			phoneDirectory,
			graceFullLoading
		},
		data() {
			return {
				button_color:'',//按钮颜色
				//示例数据
				phones:{
					tj:[],A:[],B:[],C:[],D:[],E:[],F:[],G:[],H:[],I:[],J:[],K:[],L:[],M:[],N:[],O:[],P:[],Q:[],R:[],S:[],T:[],U:[],V:[],W:[],X:[],Y:[],Z:[]
				},
				fakahang:'',
				banck_card:'',
				graceFullLoading : true
			
			}
		},
		onLoad(opt) {
			console.log(opt);
			var type=opt.type;
			var types = opt.types
			this.fakahang=opt.banck;
			if(opt.banck==='实名认证'){
				type='储蓄卡';
				}
				console.log()
			var vm=this;
			
			// var objcer = {
			// 	type:type,
			// 	types:types,
			// }
			// console.log(objcer);
			// return
			this.myPost('/api/Publicapi/get_bank',
			{type:type,types:types},
			function(res){
				console.log(res.data);
				for (var var1 in res.data) {
					var	back={
						id:res.data[var1].id,
						spell:res.data[var1].name,
						name:res.data[var1].name
					}
					// if (res.data[var1].is_recommend==='1'){
					// 	vm.phones.tj.push(back);
					// }else{
					// 	vm.phones[res.data[var1].bank_alphabet].push(back);
					// 	vm.graceFullLoading=false
					// }
					if (res.data[var1].is_recommend==='1'){
						vm.phones.tj.push(back);
					}
					
					vm.phones[res.data[var1].bank_alphabet].push(back);
					vm.graceFullLoading=false
					
				}
				
			}
			)
		},
		onBackPress(){
			uni.$off('xuanzefakahang');
		},
		methods : {
			// showFullLoading : function(){
			// 			this.graceFullLoading = true;
			// 			setTimeout(()=>{this.graceFullLoading = false;}, 3000);
			// 		},
			paramClick (e) {
				console.log(e);
				console.log(this.fakahang);
				uni.$emit('xuanzefakahang',{id:e.id,name:e.name});
				// this.Back(1);
				uni.navigateBack({
					delta:1
				});
				// if(this.fakahang==='储蓄卡'){
					
				// this.reto('/pages/add_savings_card/add_savings_card?id='+e.id+'&name='+e.name);
				// }else if(this.fakahang==='信用卡'){
				// this.reto('/pages/add_credit_card/add_credit_card1?id='+e.id+'&name='+e.name);
				// }else if(this.fakahang==='实名认证'){
				// this.reto('/pages/authentication/authentication2?id='+e.id+'&name='+e.name)
				// }
			}
		}
	}
</script>

<style>

</style>
